package com;

import org.apache.commons.lang.builder.ToStringBuilder;

import java.io.Serializable;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by likunping on 2018/9/14.
 * description:BK报价实体类
 */
public class BkPriceConDepth implements Serializable {

    List<DepthPrice> asks = new LinkedList<>();  //卖
    List<DepthPrice> bids = new LinkedList<>();  //买
    private String symbol;//交易币对
    private long createTime;//整合时间撮
    private Integer dbId; //网关报价返参存入数据库ID
    /**
     * 功能说明：报价时间点埋点时间戳
     * Author：spring
     * Date：2018/10/16 下午1:42
     */
    private TimeStatistics timeStatistics = new TimeStatistics();

    public BkPriceConDepth() {
    }

    public BkPriceConDepth(String symbol, long createTime) {
        this.symbol = symbol;
        this.createTime = createTime;
    }

    public BkPriceConDepth(String symbol, long createTime, List<DepthPrice> asks, List<DepthPrice> bids) {
        this.symbol = symbol;
        this.createTime = createTime;
        this.asks = asks;
        this.bids = bids;
    }

    public TimeStatistics getTimeStatistics() {
        return timeStatistics;
    }

    public BkPriceConDepth setTimeStatistics(TimeStatistics timeStatistics) {
        this.timeStatistics = timeStatistics;
        return this;
    }

    public String getSymbol() {
        return symbol;
    }

    public BkPriceConDepth setSymbol(String symbol) {
        this.symbol = symbol;
        return this;
    }

    public long getCreateTime() {
        return createTime;
    }

    public BkPriceConDepth setCreateTime(long createTime) {
        this.createTime = createTime;
        return this;
    }

    public List<DepthPrice> getAsks() {
        return asks;
    }

    public BkPriceConDepth setAsks(List<DepthPrice> asks) {
        this.asks = asks;
        return this;
    }

    public List<DepthPrice> getBids() {
        return bids;
    }

    public BkPriceConDepth setBids(List<DepthPrice> bids) {
        this.bids = bids;
        return this;
    }

    /**
     * 功能说明：设置报价整个后入redis缓存时间
     * Author：spring
     * Date：2018/10/16 下午1:45
     */
    public BkPriceConDepth addBKCacheTime(long bKCacheTime) {
        timeStatistics.setBkc(bKCacheTime);
        return this;
    }


    /**
     * 功能说明：设置询价后入redis缓存时间
     * Author：spring
     * Date：2018/10/16 下午1:45
     */
    public BkPriceConDepth addLPCacheTime(long lPCacheTime) {
        timeStatistics.setLpc(lPCacheTime);
        return this;
    }


    /**
     * 功能说明：设置询价结束时间
     * Author：spring
     * Date：2018/10/16 下午1:45
     */
    public BkPriceConDepth addLPEndTime(long lPEndTime) {
        timeStatistics.setLpe(lPEndTime);
        return this;
    }


    /**
     * 功能说明：设置询价开始时间
     * Author：spring
     * Date：2018/10/16 下午1:45
     */
    public BkPriceConDepth addLPStartTime(long lPStartTime) {
        timeStatistics.setLps(lPStartTime);
        return this;
    }

    public Integer getDbId() {
        return dbId;
    }

    public BkPriceConDepth setDbId(Integer dbId) {
        this.dbId = dbId;
        return this;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("asks", asks)
                .append("bids", bids)
                .append("symbol", symbol)
                .append("createTime", createTime)
                .append("dbId", dbId)
                .append("timeStatistics", timeStatistics)
                .toString();
    }
}
